package generics;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class Student<T> extends Person<T>{
    public Student() {
        System.out.println("Student Start -----");
        Type type = getClass().getGenericSuperclass();
        System.out.println("类型："+type);
        Class<?> superclass = getClass().getSuperclass();
        System.out.println("类型："+superclass);
        Type[] genericInterfaces = getClass().getGenericInterfaces();
        System.out.println("类型："+genericInterfaces);

        if (type instanceof ParameterizedType){
            System.out.println("有泛型");
            Type[] types = ((ParameterizedType) type).getActualTypeArguments();
            System.out.println(types[0]);
        }
        System.out.println("Student End -----");
    }
}
